/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author freis
 */
@Entity
@Table(name = "funcoes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Funcoes.findAll", query = "SELECT f FROM Funcoes f"),
    @NamedQuery(name = "Funcoes.findByIdFuncoes", query = "SELECT f FROM Funcoes f WHERE f.idFuncoes = :idFuncoes"),
    @NamedQuery(name = "Funcoes.findByFuncao", query = "SELECT f FROM Funcoes f WHERE f.funcao = :funcao"),
    @NamedQuery(name = "Funcoes.findByDescricaoFuncao", query = "SELECT f FROM Funcoes f WHERE f.descricaoFuncao = :descricaoFuncao")})
public class Funcoes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idFuncoes")
    private Integer idFuncoes;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "funcao")
    private String funcao;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "descricaoFuncao")
    private String descricaoFuncao;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "funcoesidFuncoes")
    private Collection<Funcionarios> funcionariosCollection;

    public Funcoes() {
    }

    public Funcoes(Integer idFuncoes) {
        this.idFuncoes = idFuncoes;
    }

    public Funcoes(Integer idFuncoes, String funcao, String descricaoFuncao) {
        this.idFuncoes = idFuncoes;
        this.funcao = funcao;
        this.descricaoFuncao = descricaoFuncao;
    }

    public Integer getIdFuncoes() {
        return idFuncoes;
    }

    public void setIdFuncoes(Integer idFuncoes) {
        this.idFuncoes = idFuncoes;
    }

    public String getFuncao() {
        return funcao;
    }

    public void setFuncao(String funcao) {
        this.funcao = funcao;
    }

    public String getDescricaoFuncao() {
        return descricaoFuncao;
    }

    public void setDescricaoFuncao(String descricaoFuncao) {
        this.descricaoFuncao = descricaoFuncao;
    }

    @XmlTransient
    public Collection<Funcionarios> getFuncionariosCollection() {
        return funcionariosCollection;
    }

    public void setFuncionariosCollection(Collection<Funcionarios> funcionariosCollection) {
        this.funcionariosCollection = funcionariosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFuncoes != null ? idFuncoes.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Funcoes)) {
            return false;
        }
        Funcoes other = (Funcoes) object;
        if ((this.idFuncoes == null && other.idFuncoes != null) || (this.idFuncoes != null && !this.idFuncoes.equals(other.idFuncoes))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Funcoes[ idFuncoes=" + idFuncoes + " ]";
    }
    
}
